import { DelayBrilliantness } from "@/core/cardsystem/brilliantness/delay";
import { Player } from "../player";


export class JudgeAreaController {

    owner: Player
    
    judgeArea: DelayBrilliantness[]

    constructor(owner: Player) {
        this.owner = owner
        this.judgeArea = []
    }

    hasCards(): boolean {
        return this.judgeArea.length > 0
    }

    canPushJudgeArea(card: DelayBrilliantness): boolean {
        for(const dge of this.judgeArea) {
            if (dge instanceof card.constructor) {
                return false
            }
        }

        return true
    }

    pushToJudgeArea(card: DelayBrilliantness): void {
        this.judgeArea.unshift(card)
    }

    removeFromJudgeArea(card: DelayBrilliantness): void {
        this.judgeArea = this.judgeArea.filter(t => !t.equals(card))
    }

}
